home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / program / libkb100.zip / LIBKB-1.00 / UTIL / HARDWARE.DOC < prev    next >
Text File  |  1996-07-23  |  3KB  |  63 lines

  1. news:rec.games.programmer
  2.  
  3. Subject: Re: more keyboard handler woes...
  4. From: gordon@sneaky.lonestar.org (Gordon Burditt)
  5.  
  6. > > Those are natural limitations of the "matrix" method that
  7. > > keyboard are built using. There are *NOT* one single wire
  8. > > for each key - but instead the keyboard uses a grid of wires
  9. > > so that when a key is pressed a connection wil be formed
  10. > > between a row and a column. Therefore if you press several
  11. > > keys simultaneously - another connection might be perceived
  12. > > by the keyboard controller! 
  13. > Yes, but the keyboard controller CPU is supposed to be smart enough to
  14. > identify the keys as they are pressed and subtract their effects from
  15. > future key manipulations. 
  16. > Are they incapable of performing N key rollover? 
  17.  
  18. Each key is connected to two wires, shown as horizontal and vertical
  19. below.  When the key is pressed, it connects these two wires.
  20. The keyboard controller sends out a signal on one of the horizontal 
  21. wires and observes which of the vertical wires have the signal appear.  
  22. Then it tries the next wire, and so on.  From this, it can determine
  23. which keys are pressed.  Usually.  You won't have a problem if
  24. no more than 3 keys are down at once.
  25.  
  26. -------A-------B-------C-------D-------E--------F
  27.        |       |       |       |       |        |
  28. -------G-------H-------I-------J-------K--------L
  29.        |       |       |       |       |        |
  30. -------M-------N-------O-------P-------Q--------R
  31.        |       |       |       |       |        |
  32. -------S-------T-------U-------W-------X--------Y
  33.        |       |       |       |       |        |
  34.  
  35.  
  36. Suppose keys A, B, and S are pressed.  If the keyboard CPU sends
  37. out a signal on the horizontal wire connected to S, it gets back
  38. signals on the vertical wires connected to both S and T.  Why T?
  39. Because there's a sneak path through keys S, A, and B that makes
  40. it look like T is pressed also.  The CPU can't actually tell
  41. whether T is pressed, as there is no difference in the signals.
  42. You get this problem every time 3 keys in a rectangle are
  43. pressed.  The keyboard CPU may suppress the phantom make code
  44. for T, but it can't detect real makes and breaks for it.
  45. (I suppose they could design keyboards with a diode at each key
  46. to prevent this, but that costs extra money.  The current is going
  47. backwards through A in the above example, and a diode would block
  48. that.)
  49.  
  50. Now consider what happens if keys A, B, C, D, E, F, K, Q, and X
  51. are pressed.  Every time ANY signal is sent out on a horizontal
  52. wire, it comes back on all of the vertical wires.  You can't
  53. tell whether any of the other keys are pressed, so the
  54. keyboard won't respond to any of them.
  55.  
  56. It is also possible to design keyboards so that the keys in
  57. rectangles are all unlikely to be used together.  It takes a
  58. lot of good guessing to determine what those will be for
  59. next year's games.
  60.  
  61.                     Gordon L. Burditt
  62.                     sneaky.lonestar.org!gordon
  63.